<template>
	<view>
		<!-- <view class="img-box" >
			<image src="" class="img" mode=""></image>
		</view> -->
		<swiper class="img-box" :autoplay="true" :interval="5000" :duration="500"
		 :style="{'height':windowHeight}">
			<swiper-item :style="{'height':windowHeight}">
				<view class="swiper-item" :style="{'height':windowHeight}">
					<image :src="guideImg" class="img" :style="{'height':windowHeight}"></image>
					<!-- <view class="guide-time" @click.stop="toIndex">
						跳过 {{timers}}
					</view> -->
				</view>
			</swiper-item>
		</swiper>
		<!-- <view class="count-time" @click="skip" :style="{'top':(StatusBar + 20) + 'px'}">
			({{timers}}s)跳过
		</view> -->
		
	</view>
</template>

<script>
	let timer = ''
	import http from '@/api/http.js'
	export default {
		data() {
			return {
				list:[],
				guideImg:'',
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar,
				windowHeight:"667px",
				timers:3,
				showBeginShadow:false,
				info:{}
			}
		},
		onLoad(option){
			
			this.getInfo();
			this.getList();
			//#ifndef MP-WEIXIN
				let _me = this;
				uni.getSystemInfo({//获取手机屏幕高度信息，让swiper的高度和手机屏幕一样高
					success: function(res) {
						console.log(res.model);
						console.log(res.pixelRatio);
						console.log(res.windowWidth);
						console.log(res.windowHeight);//这里是手机屏幕高度
						console.log(res.language);
						console.log(res.version);
						console.log(res.platform);
						_me.windowHeight = res.windowHeight + 'px';
						console.log('手机屏幕高度为' + _me.windowHeight);
					}
				});
			// #endif 
		},
		onUnload() {
			// clearInterval(timer);
		},
		methods: {
			getInfo(){
				this.$http('Setting/get_agreement',{type:4}).then(res=>{
					this.info = res.data;
					if(this.info.agreement){
						let reg = new RegExp('<img','gi');
						this.info.agreement = this.info.agreement.replace(reg,'<img style="width:100%;vertical-align: top;"');
					};
				})
			},
			clickFlase(){
				
				if (plus.os.name.toLowerCase() === 'android') {
					plus.runtime.quit();
				}else{ 
					const threadClass = plus.ios.importClass("NSThread");
					const mainThread = plus.ios.invoke(threadClass, "mainThread");
					plus.ios.invoke(mainThread, "exit");
					plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
				}
			},
			clickSure(){
				this.getInfo();
				this.getList();
				uni.setStorageSync('agree', '1');
				this.showBeginShadow = false;
				this.countdown();
			},
			jumps(type){
				uni.navigateTo({
					url:'/pages/mine/set/agreement?type='+type
				})
			},
			getList(){
				this.$http('Setting/get_leading_chart').then(res=>{
					if(res.status == 200){
						this.timers = res.data.startover_second;
						// this.list = res.data.startover_img_url;
						this.guideImg = res.data.startover_img_url;
					}
					console.log(res)
				})
			},
			
			
		}
	}
</script>

<style lang="less">
	.img-box{
		
		.img{
			width: 100%;
		}
	}
	.count-time{
		font-size: 32upx;
		color: #fff;
		position: fixed;
		right: 40upx;
		z-index: 20;
	}
	.showDow{width:100%;height:100%;position: fixed;top:0;left:0;z-index: 30}
	.showDow .bg_grey{width:100%;height:100%;position: fixed;top:0;left:0;z-index: 3;background: rgba(0,0,0,0.4);}
	.showDow .bg_white{width:80%;height:auto;transform: translate(-50%,-50%);padding:2% 5%;position: fixed;top:50%;left:50%;z-index: 3;background:white;border-radius: 10upx;}
	.showDow .bg_white .title{font-size: 18px;padding:50upx 0;margin-bottom: 0upx;font-weight: bold;text-align: center;}
	.showDow .bg_white .titlesA{font-size: 12px;padding:0;height: 420upx;margin-bottom: 0upx;overflow-y: auto;}
	.showDow .bg_white .jumps{display: inline;color:#181C62;font-weight: bold;}
	.showDow .bg_white .btnSure{color:#C68660;font-size: 18px;border-top: 1px solid #E5E5E5;;padding:20upx 0;}
	.showDow .bg_white .btns{width:50%;float: left;border-top: 1px solid #E5E5E5;padding:20upx 0;text-align: center;}
	.showDow .bg_white .falseBtn{color:#999999}
	.showDow .bg_white .sureBtn{color:#181C62}
</style>
